package com.ruoyi.web.controller.dr;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.dr.domain.DrHomeScore;
import com.ruoyi.dr.service.IDrHomeScoreService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 带货评分信息 /api/authorStatData/authorReputationDetailController
 * 
 * @author ruoyi
 * @date 2025-07-12
 */
@RestController
@RequestMapping("/dr/score")
public class DrHomeScoreController extends BaseController
{
    @Autowired
    private IDrHomeScoreService drHomeScoreService;

    /**
     * 查询带货评分信息 /api/authorStatData/authorReputationDetail列表
     */
    @PreAuthorize("@ss.hasPermi('dr:score:list')")
    @GetMapping("/list")
    public TableDataInfo list(DrHomeScore drHomeScore)
    {
        startPage();
        List<DrHomeScore> list = drHomeScoreService.selectDrHomeScoreList(drHomeScore);
        return getDataTable(list);
    }

    /**
     * 导出带货评分信息 /api/authorStatData/authorReputationDetail列表
     */
    @PreAuthorize("@ss.hasPermi('dr:score:export')")
    @Log(title = "带货评分信息 /api/authorStatData/authorReputationDetail", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DrHomeScore drHomeScore)
    {
        List<DrHomeScore> list = drHomeScoreService.selectDrHomeScoreList(drHomeScore);
        ExcelUtil<DrHomeScore> util = new ExcelUtil<DrHomeScore>(DrHomeScore.class);
        util.exportExcel(response, list, "带货评分信息 /api/authorStatData/authorReputationDetail数据");
    }

    /**
     * 获取带货评分信息 /api/authorStatData/authorReputationDetail详细信息
     */
    @PreAuthorize("@ss.hasPermi('dr:score:query')")
    @GetMapping(value = "/{uid}")
    public AjaxResult getInfo(@PathVariable("uid") String uid)
    {
        return success(drHomeScoreService.selectDrHomeScoreByUid(uid));
    }

    /**
     * 新增带货评分信息 /api/authorStatData/authorReputationDetail
     */
    @PreAuthorize("@ss.hasPermi('dr:score:add')")
    @Log(title = "带货评分信息 /api/authorStatData/authorReputationDetail", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DrHomeScore drHomeScore)
    {
        return toAjax(drHomeScoreService.insertDrHomeScore(drHomeScore));
    }

    /**
     * 修改带货评分信息 /api/authorStatData/authorReputationDetail
     */
    @PreAuthorize("@ss.hasPermi('dr:score:edit')")
    @Log(title = "带货评分信息 /api/authorStatData/authorReputationDetail", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DrHomeScore drHomeScore)
    {
        return toAjax(drHomeScoreService.updateDrHomeScore(drHomeScore));
    }

    /**
     * 删除带货评分信息 /api/authorStatData/authorReputationDetail
     */
    @PreAuthorize("@ss.hasPermi('dr:score:remove')")
    @Log(title = "带货评分信息 /api/authorStatData/authorReputationDetail", businessType = BusinessType.DELETE)
	@DeleteMapping("/{uids}")
    public AjaxResult remove(@PathVariable String[] uids)
    {
        return toAjax(drHomeScoreService.deleteDrHomeScoreByUids(uids));
    }
}
